package com.example.ioc1.controller;

import com.example.ioc1.component.UserComponent;
import com.example.ioc1.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class HelloController {
//    @Autowired
    private UserService userService;
    //private UserComponent userComponent;

//    public HelloController() {
//    }
//
//    @Autowired
//    public HelloController(UserService userService) {
//        this.userService = userService;
//    }

    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    //    @Autowired/
//    public HelloController(UserService userService, UserComponent userComponent) {
//        this.userService = userService;
//        this.userComponent = userComponent;
//    }

    public void sayHi() {
        userService.doService();
        //userComponent.doComponent();
        System.out.println("hi, hello Controller...");
    }
}
